package com.yywz.rmi;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class WarehouseServer {

	public static void main(String[] args) throws RemoteException, NamingException {
		System.out.println("constructing server implementation...");
		WarehouseImpl centralWarehouse = new WarehouseImpl();
		
		System.out.println("Binding server implementation to registry...");
		LocateRegistry.createRegistry(1099);
		Context namingContext = new InitialContext();
		namingContext.bind("rmi://127.0.0.1:1099/central_warehouse", centralWarehouse);
		
		System.out.println("Waiting for invocations from clients...");
		
	}

}
